// 测试数据格式兼容性
console.log('=== 测试后端返回的数据格式 ===');

// 模拟后端返回的数据格式（修改后）
const backendResponse = {
  success: true,
  data: {
    totalScore: 85,
    overallComment: "作业完成得不错",
    strengths: "计算准确",
    weaknesses: "书写需要改进",
    suggestions: "注意字迹工整",
    encouragement: "继续努力",
    fillInBlanks: [
      {
        question: "根据AI分析的作业内容",
        studentAnswer: "学生答案",
        correctAnswer: "标准答案",
        isCorrect: true
      }
    ],
    calculations: [
      {
        expression: "AI识别的计算题",
        studentAnswer: "学生计算结果",
        correctAnswer: "正确答案",
        isCorrect: true
      }
    ],
    computations: [],
    fillInBlanksScore: 20,
    calculationsScore: 30,
    computationsScore: 0
  }
};

console.log('后端响应数据:', JSON.stringify(backendResponse, null, 2));

// 模拟小程序端处理
const gradingResult = backendResponse.data;

console.log('\n=== 小程序端数据验证 ===');
console.log('总分:', gradingResult.totalScore);
console.log('填空题数量:', gradingResult.fillInBlanks ? gradingResult.fillInBlanks.length : 0);
console.log('计算题数量:', gradingResult.calculations ? gradingResult.calculations.length : 0);
console.log('计算题数量:', gradingResult.computations ? gradingResult.computations.length : 0);

// 验证界面显示条件
console.log('\n=== 界面显示条件验证 ===');
console.log('显示填空题:', !!(gradingResult.fillInBlanks && gradingResult.fillInBlanks.length > 0));
console.log('显示计算题:', !!(gradingResult.calculations && gradingResult.calculations.length > 0));
console.log('显示计算题:', !!(gradingResult.computations && gradingResult.computations.length > 0));

console.log('\n=== 测试完成 ===');